package band.wukong.practice.javase.core.io.readerandwriter;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

/**
 * Desc:
 * Author: sunjs
 * Date: 2009-11-16 16:38:46
 */
public class TestFileReader {
    static final String FILE_IN = "E:\\workspace\\TestJava\\src\\com\\jsun\\javase\\io\\doc\\poem.txt";

    public static void main(String[] args) throws Exception {
        FileReader reader = new FileReader(new File(FILE_IN));
        BufferedReader bufferedReader = new BufferedReader(reader);

        int data;
        while ((data = bufferedReader.read()) != -1) {
            System.out.print((char) data);
        }
        reader.close(); //close方法不执行任何操作

        //为了提高效率，可以用BufferedReader来装饰InputStreamReader
    }
}
